#ifndef CARDRW_H
#define CARDRW_H

#include <QWidget>

namespace Ui {
class CardRW;
}

#include "idcardread.h"

class CardRW : public QWidget
{
    Q_OBJECT

public:
    explicit CardRW(QWidget *parent = 0);
    ~CardRW();

public:
    void ShowDuKa(QByteArray &data);
    bool GetInfo(QByteArray &data, QByteArray &keyb, QByteArray &blk3, int &mode);
    void GetKeyB(QByteArray &keyb);
    bool GetSpecKeyB(QByteArray &keyb);
    void Clear();

signals:
    void pbEvent(int e);

private:
    void encrypt(QByteArray &out, char mi, QString str);
    void decrypt(QByteArray data, char mi, QString &val);
    void getValues(QByteArray &data, QMap<QString, QString> &val);
    QByteArray makeItem(char type, QString str);
    QString fromBCD(QByteArray &data);
    bool SFZHValid(QString sfz);

private slots:
    void on_pbDuKa_clicked();

    void on_pbXieKa_clicked();

public slots:
    void idcRcv(IdCData idd);

private:
    Ui::CardRW *ui;

public:
    QString statustip;
};

#endif // CARDRW_H
